package com.wang.user.controller;

import com.wang.common.model.dto.LoginDto;
import com.wang.common.model.dto.ResponseResult;
import com.wang.user.service.IAppUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * App端登录接口
 *
 * @author: wangning
 * @date: 2023/12/26 10:40
 */
@RestController
@RequestMapping("/api/v1/login")
public class AppLoginController {

    @Autowired
    private IAppUserService userService;

    /**
     *
     * @param loginDto 手机号 密码 提供用户（13511223456，admin）
     * @return Map {
     *     "user": {},
     *     "token": eyJhbGciOiJIUzUxMiIsInppcCI6IkdaSVAifQ.H4sIAAAAAAAAADWL0QqDMAxF_yXPFqKma-rfpFpHBxuFVFTG_n3xwZfLPRzOF16twARzP64pR3EUIzpCnx3j8HCBfJCEkmyhgyINpj4geyZi7kC3ZLWe2vL78qqGu3yeBrItBlKr_XzUO2S8wmKOfn-8BDnyfwAAAA.0ODrZ4COErFNInpRb75x11UdpgUVMDm_Oiv5Z_j_st7jUU3eUI18hgOcbZs5TGg1YKUKe-bJ8OuEkyw6VdPZyw
     * }
     */
    @PostMapping("/login_auth")
    public ResponseResult login(@RequestBody LoginDto loginDto){
        return userService.login(loginDto);
    }
}
